package com.software.sqlite.utils;
import java.io.File;
import java.nio.file.Files;
import java.util.Base64;

public class ImageToBase64Converter {
    public static String convertToBase64(File imageFile) {
        try {
            byte[] fileContent = Files.readAllBytes(imageFile.toPath());
            return Base64.getEncoder().encodeToString(fileContent);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static void main(String[] args) {
        File imageFile = new File("C:\\ShipMovie\\manage\\movies\\8871.jpg");
        String base64String = convertToBase64(imageFile);
        System.out.println(base64String);
    }
}
